/*
============================================================================
 Name        : AudioRecorder.h
 Author      : DANG Zhengfa
 Version     :
 Copyright   : Zhengfa Company Limited
 Description : CAudioRecorder declaration
============================================================================
*/

#ifndef AUDIORECORDER_H
#define AUDIORECORDER_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <mda\client\utility.h>  // for MMdaObjectStateChangeObserver

// CLASS DECLARATION
class CMdaAudioRecorderUtility;
class CWsClient;

/**
*  CAudioRecorder
* 
*/
class CAudioRecorder : public CBase, public MMdaObjectStateChangeObserver
{
public: // Constructors and destructor

	/**
        * Destructor.
        */
	~CAudioRecorder();

        /**
        * Two-phased constructor.
        */
	static CAudioRecorder* NewL();

        /**
        * Two-phased constructor.
        */
	static CAudioRecorder* NewLC();

	// from interface MMdaObjectStateChangeObserver
	void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);

private:

	/**
        * Constructor for performing 1st stage construction
        */
	CAudioRecorder();

	/**
        * EPOC default constructor for performing 2nd stage construction
        */
	void ConstructL();

	// 
	void MoscoStateChangeEventL(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);

private:
	CMdaAudioRecorderUtility *iRecorder;

	enum TRecorderState
	{
		ENotReady = 0,
		EInit,
		EOpen,
		EPlaying,
		ERecording
	};

	TRecorderState  iState;

	// small flashing window
	CWsClient* iClient;
	TRect iClientRect;

public:
	void RecordMessageL(TBool aIsLocal);
	void StopRecord();
	TBool IsRecording();


};

#endif // AUDIORECORDER_H
